package p270jp.pxv.android.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.BackStackRecord;
import androidx.fragment.app.Fragment;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import p014ae.AbstractActivityC0188y2;
import p047bg.C1124a;
import p090d0.C2518n;
import p111dl.RankingService;
import p116e.ActionBar;
import p270jp.pxv.android.R;
import p270jp.pxv.android.legacy.constant.ContentType;
import p314lg.ActivityRankingSingleBinding;
import p350mp.Timber;
import p370ni.RankingCategory;
import p547uh.IllustRankingFragment;
import p547uh.NovelRankingFragment;

/* renamed from: jp.pxv.android.activity.RankingSingleActivity */
/* loaded from: classes2.dex */
public class RankingSingleActivity extends AbstractActivityC0188y2 {

    /* renamed from: jp.pxv.android.activity.RankingSingleActivity$a */
    /* loaded from: classes2.dex */
    public static /* synthetic */ class C4076a {

        /* renamed from: a */
        public static final /* synthetic */ int[] f18567a;

        static {
            int[] iArr = new int[ContentType.values().length];
            f18567a = iArr;
            try {
                iArr[ContentType.ILLUST.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f18567a[ContentType.MANGA.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f18567a[ContentType.NOVEL.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    /* renamed from: e1 */
    public static Intent m4757e1(Context context, RankingCategory cVar, Date date) {
        Intent intent = new Intent(context, RankingSingleActivity.class);
        intent.putExtra("MODE", cVar);
        intent.putExtra("DATE", date);
        return intent;
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        Fragment fragment;
        super.onCreate(bundle);
        ActivityRankingSingleBinding h1Var = (ActivityRankingSingleBinding) DataBindingUtil.m11369d(this, R.layout.activity_ranking_single);
        RankingCategory cVar = (RankingCategory) getIntent().getSerializableExtra("MODE");
        Date date = (Date) getIntent().getSerializableExtra("DATE");
        ContentType contentType = cVar.f23752a;
        int i = C4076a.f18567a[contentType.ordinal()];
        if (i == 1 || i == 2) {
            fragment = IllustRankingFragment.m1632h(cVar, date);
        } else if (i != 3) {
            Timber.f23100a.mo3525d("invalid content type", new Object[0]);
            return;
        } else {
            fragment = NovelRankingFragment.m1520w(cVar, date);
        }
        this.f18757A.m6525e(((RankingService) C2518n.m7641d(RankingService.class)).m7228a(contentType));
        C1124a.m10197Q(this, h1Var.f21647t, RankingCategory.f23731f.m3361b(contentType));
        if (date != null) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(getString(R.string.ranking_log_title_date), Locale.US);
            ActionBar P0 = m7044P0();
            P0.mo6930u(simpleDateFormat.format(date) + getString(cVar.f23753b));
        }
        BackStackRecord cVar2 = new BackStackRecord(m11131K0());
        cVar2.m11165j(R.id.ranking_fragment_container, fragment);
        cVar2.mo11171d();
    }
}
